define(['jquery', 'knockout', 'eventbus', 'dataservice'], function ($, ko, eventbus, ds) {
	return function () {

		// Click callback for the registration button.
		let onRegisterClick = function () {
			// TODO: do we really need jQuery for this? other options with kockout?
			let regData = {
				name: $("#name").val(),
				email: $("#email").val(),
				password: $("#password").val()
			}

			// Send the account details to the backend.
			ds.postNewAccount(function () {
				// Notify the rest of the components.
				eventbus.publish("changeComponentEvent", "login");
			}, regData);
		}

		// Expose what the UI needs.
		return {
			title: 'Registration',
			onRegisterClick
		}
	}
});